<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="layouts::header"></head>

<body>
<nav th:replace="layouts::navbar"></nav>
<div class="container">
    <h3>学生目录</h3>
    <br>
    <a  th:href="@{/students/new}" href="#" class="btn btn-primary btn-sm mb-3">新增学生</a>
    <br>
    <table>
        <thead>
        <tr>
            <td>姓名</td>
            <td>微信号</td>
            <td>邮箱</td>
            <td>动作</td>
        </tr>
        </thead>
        <tbody>
        <tr th:each="aStudent : ${students}">
            <td th:text="${aStudent.name}"></td>
            <td th:text="${aStudent.wechatId}"></td>
            <td th:text="${aStudent.email}"></td>
            <td>
                <a th:href="@{/students/update(id=${aStudent.studentId})}"
                   class="btn btn-info btn-sn"
                    onclick="if(!(confirm('你确认删除这个学生？'))) return false"
                >更新</a>
            </td>
        </tr>
        </tbody>
    </table>
</div>
</body>
</html>